import { MockMethod } from "vite-plugin-mock";
import Mock from "mockjs";
import response from "mock/response";
import authRoutes from "./auth-routes";

const memberList = Mock.mock({
  "list|1-10": [
    {
      id: "@id",
      userName: "@cname",
      userNo: "20200700" + "@integer(30101, 30630)",
      userGender: '@pick(["男", "女"])',
      userTel: "13712345678",
      userClass: "2020级软件工程5班",
      userRole: '@pick(["管理员", "普通成员"])',
      userRegisterTime: "@datetime",
      userCurPoint: "@integer(100, 999)",
      userCurStatus: '@pick("正常", "禁止")',
    },
  ],
});

export default [
  {
    url: "/api/member",
    method: "get",
    timeout: 1000,
    response: () => response(memberList.list),
  },
  {
    url: "/api/permissions",
    method: "get",
    timeout: 1000,
    response: () =>
      response(["sys:member:add", "sys:member:delete", "sys:member:update", "sys:member:list"]),
  },
  {
    url: "/api/auth-routes",
    method: "get",
    timeout: 100,
    response: () => response(authRoutes),
  },
] as MockMethod[];
